package com.bw.produce.service.impl;




import com.bw.produce.domain.Property;
import com.bw.produce.domain.dto.PropertyDTO;
import com.bw.produce.domain.vo.PropertyVO;
import com.bw.produce.mapper.PropertyMapper;
import com.bw.produce.query.PropertyQueryObject;
import com.bw.produce.service.IPropertyService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lemon
 * @date 2024/11/15 20:46
 **/
@Service
public class PropertyServiceImpl implements IPropertyService {

    @Autowired
    PropertyMapper propertyMapper;


    @Override
    public List<PropertyVO> selectPropertyList(PropertyQueryObject queryParams) {
        return propertyMapper.selectAll(queryParams);
    }

    @Override
    public void insertProperty(PropertyDTO propertyDTO) {
        Property property = new Property();
        BeanUtils.copyProperties(propertyDTO,property);
        propertyMapper.insert(property);
    }

    @Override
    public void updateProperty(PropertyDTO propertyDTO) {
        Property property = new Property();
        BeanUtils.copyProperties(propertyDTO,property);
        propertyMapper.update(property);
    }


    @Override
    public void deletePropertyById(Long[] propertyId) {
        propertyMapper.deleteByIds(propertyId);
    }

    @Override
    public PropertyVO getInfo(Long propertyId) {
        return propertyMapper.selectInfo(propertyId);
    }


}
